package com.bitcola.security.activity.controller;

import com.bitcola.security.activity.biz.LockBiz;
import com.bitcola.security.common.context.BaseContextHandler;
import com.bitcola.security.common.msg.AppResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("lockPosition")
public class LockPositionController {



   @Autowired
   LockBiz lockBiz;


    @RequestMapping(value = "query")

    public AppResponse query(){

        String userId = BaseContextHandler.getUserID();
        var list=  lockBiz.getAllLock(userId);

        return AppResponse.ok().data(list);
    }



    @RequestMapping(value = "queryLog")

    public AppResponse queryLog(Long endTime,int size ){

        if(endTime==null) endTime=System.currentTimeMillis();
        String userId = BaseContextHandler.getUserID();
        var list=  lockBiz.queryLog(userId,new Date(endTime),size);

        return AppResponse.ok().data(list);
    }







}
